const { addrFormatError } = require("../consisitant/err.type")

const addrValidator = (rules) => {
    return async (ctx, next) => {
        try {
            ctx.verifyParams(rules)
        } catch (err) {
            ctx.app.emit('error', addrFormatError, ctx)
        }
        await next()
    }
}

module.exports = {
    addrValidator
}